package com.ishanggang.controller;

import com.ishanggang.service.BrandMatchJddjStoreService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 品牌门店匹配到家门店业务逻辑
 */
@RestController
@RequestMapping("/brand")
public class BrandShopMatchController {

    @Resource
    BrandMatchJddjStoreService brandMatchJddjStoreService;

    @RequestMapping(value = {"/initJddjStoreInfo"})
    String initJddjStoreInfo() {
        this.brandMatchJddjStoreService.initRedisJddjStoreInfo();
        return "redis init!";
    }

    @RequestMapping(value = {"/updateRetailerQuechaoGroupId"})
    String updateRetailerQuechaoGroupId() {
        this.brandMatchJddjStoreService.updateRetailerQuechaoGroupId();
        return "redis init!";
    }

    @RequestMapping(value = {"/queryNearByJddjShopList/{lng}/{lat}"}, method = {RequestMethod.GET})
    String queryNearByJddjShopList(@PathVariable(value = "lng") String lng, @PathVariable(value = "lat") String lat) {
        this.brandMatchJddjStoreService.queryNearByJddjShopList(Double.parseDouble(lng), Double.parseDouble(lat));
        return "build item success!";
    }

    @RequestMapping(value = {"/buildQueChaoJDDJStoreId/{id}"}, method = {RequestMethod.GET})
    String buildQueChaoJDDJStoreId(@PathVariable(value = "id") Long id) {
        this.brandMatchJddjStoreService.buildQueChaoJDDJStoreIdItem(id, null, null, null);
        return "build item success!";
    }

    @RequestMapping(value = {"/queChaoJDDJStoreMatchProcessDetail/{id}"}, method = {RequestMethod.GET})
    String queChaoJDDJStoreMatchProcessDetail(@PathVariable(value = "id") Long id) {
        this.brandMatchJddjStoreService.queChaoJDDJStoreMatchProcessDetail(id, null, null);
        return "build item success!";
    }

    @RequestMapping(value = {"/buildAllQueChaoJDDJStoreId"})
    String buildAllQueChaoJDDJStoreId() {
        this.brandMatchJddjStoreService.buildQueChaoJDDJStoreId();
        return "build all success!";
    }

    @RequestMapping(value = {"/updateShopLongLatAddressDistance"})
    String updateShopLongLatAddressDistance(){
        this.brandMatchJddjStoreService.updateShopLongLatAddressDistance();
        return "refresh all success!";
    }

    @RequestMapping(value = {"/updateShopLongLat"})
    String updateShopLongLat(){
        this.brandMatchJddjStoreService.updateShopLongLat();
        return "refresh all success!";
    }
}
